home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol C-14 / Vol C-14.iso / games / keepy_up.swf / scripts / DefineSprite_49 / frame_8 / DoAction.as
Text File  |  2012-04-23  |  1KB  |  53 lines

  1. kicked = 1;
  2. t = Number(t) + 0.1;
  3. oldx = x;
  4. oldy = y;
  5. x = getProperty("Ball", _X);
  6. y = getProperty("Ball", _Y);
  7. vx = Number((getProperty("Ball", _X) - getProperty("mouse", _X)) * 10) + Number(random(3) / 10 - 0.15);
  8. vy = Number(-125) + Number(y - getProperty("mouse", _Y));
  9. dx = getProperty("Ball", _X) - getProperty("mouse", _X);
  10. if(0 < Number(dx))
  11. {
  12.    vy = Number(vy) + Number(dx);
  13. }
  14. else if(Number(dx) < 0)
  15. {
  16.    vy -= dx;
  17. }
  18. if(Number(y) < Number(BallRadius))
  19. {
  20.    y = BallRadius;
  21.    vx *= elastic;
  22.    vy = - vy * elastic;
  23. }
  24. if(Number(300 - BallRadius) < Number(y))
  25. {
  26.    if(Number(bestscore) < Number(score))
  27.    {
  28.       bestscore = score;
  29.    }
  30.    score = 0;
  31.    y = 300 - BallRadius;
  32.    vx *= elastic;
  33.    vy = - vy * elastic;
  34. }
  35. if(Number(x) < Number(BallRadius))
  36. {
  37.    x = BallRadius;
  38.    vx = - vx * elastic;
  39.    vy *= elastic;
  40. }
  41. if(Number(400 - BallRadius) < Number(x))
  42. {
  43.    x = 400 - BallRadius;
  44.    vx = - vx * elastic;
  45.    vy *= elastic;
  46. }
  47. setProperty("Ball", _X, x);
  48. setProperty("Ball", _Y, y);
  49. setProperty("Ball", _rotation, x);
  50. setProperty("Ball", _xscale, 100);
  51. setProperty("Ball", _yscale, 100);
  52. gotoAndPlay(6);
  53.